package com.csdj.test.service;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.csdj.test.entity.Article;
import com.csdj.test.mapper.ArticleMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 * 文章 服务实现类
 * </p>
 *
 * @author 徐守志
 * @since 2022-03-08
 */
@Service
public class ArticleService extends ServiceImpl<ArticleMapper, Article> implements IArticleService {

    @Resource
    ArticleMapper articleMapper;


    //增加数据
    @Override
    public int add(Article article) {
        return articleMapper.insert(article);
    }

    //根据id删除数据
    @Override
    public int delete(int id) {
        return articleMapper.deleteById(id);
    }

    //根据id修改
    @Override
    public int update(Article article) {
        return articleMapper.updateById(article);
    }

    //根据id查询
    @Override
    public Article find(int id) {
        return articleMapper.selectById(id);
    }
}
